package foo.bar.wiki.web.extension;

import net.sourceforge.stripes.integration.spring.SpringBean;
import net.sourceforge.stripes.validation.ValidationError;

import java.util.Collection;

import foo.bar.wiki.services.WikiService;
import foo.bar.wiki.domain.Space;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
 * @author tmjee
 * @version $Date$ $Id$
 */
public class SpaceTypeConverter extends AbstractIdentifiableTypeConverter<Space> {

    private static final Log LOG = LogFactory.getLog(SpaceTypeConverter.class);

    private WikiService wikiService;

    protected Space _convert(String id, Class<? extends Space> targetType, Collection<ValidationError> errors) {
        Space space = wikiService.getSpaceById(id);
        return space;
    }


    @SpringBean("wikiService")
    public void setWikiService(WikiService wikiService) {
        this.wikiService = wikiService;
    }
}
